package com.ssmr.demo;

import com.ssmr.demo.service.SeckillService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.concurrent.Callable;

public class SeckillTask implements Callable<Integer> {
    private Logger logger = LoggerFactory.getLogger(SeckillTask.class);

    public SeckillTask(SeckillService seckillService) {
        this.seckillService = seckillService;
    }

    private SeckillService seckillService;

    @Override
    public Integer call() throws Exception {
        int seckill = seckillService.seckill(1, 12, 2);
        logger.info("SeckillTask thread name: " + Thread.currentThread().getName());
//        Thread.sleep(2000);
        return seckill;
    }
}
